﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace TMIS.BLL
{
    public class Teacher
    {
        /// <summary>
        /// 获取教师可选学历
        /// </summary>
        /// <returns></returns>
        public string[] GetEducation()
        {
            DAL.Education dal = DALFactory.DALFactory.CreateEducation();
            return dal.Get();
        }
        /// <summary>
        /// 获取学历对应ID号
        /// </summary>
        /// <param name="education"></param>
        /// <returns></returns>
        public Guid GetEducationID(string education)
        {
            DAL.Education dal = DALFactory.DALFactory.CreateEducation();
            return dal.Get(education);
        }
        /// <summary>
        /// 获取教师可选职称
        /// </summary>
        /// <returns></returns>
        public  string[] GetTitle()
        {
            DAL.ProfessionTitle dal = DALFactory.DALFactory.CreateProfessionTitle();
            return dal.Get();
        }
        /// <summary>
        /// 获取职称对应ID号
        /// </summary>
        /// <param name="title"></param>
        /// <returns></returns>
        public Guid GetTitleID(string title)
        {
            DAL.ProfessionTitle dal = DALFactory.DALFactory.CreateProfessionTitle();
            return dal.Get(title);
        }
        /// <summary>
        /// 将教师实体数据写入到数据库中
        /// </summary>
        /// <param name="teacher"></param>
        /// <returns></returns>
        public bool Insert(Model.Teacher teacher)
        {
            DAL.Teacher dal = DALFactory.DALFactory.CreateTeacher();
            if (dal.Search(teacher.tName, teacher.tPassword) == 0)
            {
                dal.Add(teacher);
                return true;
            }
            else
                return false;
        }
        /// <summary>
        /// 根据教师ID号删除教师对应信息
        /// </summary>
        /// <param name="guid"></param>
        public void Del(Guid guid)
        {
            DAL.Teacher dal = DALFactory.DALFactory.CreateTeacher();
            dal.Del(guid);
        }
    }
}
